package com.kzj.filter;

import com.kzj.global.override.MyHttpServletRequestWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.ComponentScan;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

@WebFilter
@Slf4j
public class HttpServletRequestHandlerTransformToMyHttpServletRequestHandlerFilter implements Filter {
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        log.info("httpServletRequestWrapper->MyHttpServletRequestWrapper");
        HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
        MyHttpServletRequestWrapper myHttpServletRequestWrapper = new MyHttpServletRequestWrapper(httpServletRequest);
        filterChain.doFilter(myHttpServletRequestWrapper,servletResponse);
    }
}
